package com.youfang.sixthmedia.ui.detail;

import android.os.Bundle;

import com.youfang.sixthmedia.R;
import com.youfang.sixthmedia.common.BaiduMapActivity;
import com.youfang.sixthmedia.common.YoufangContext;
import com.youfang.sixthmedia.message.model.DetailBuilding;

public class DetailLocationActivity extends BaiduMapActivity {

	@Override
	protected void onCreate(Bundle arg0) {

		this.setContentView(R.layout.detail_location_activity);
		super.onCreate(arg0);
		
		mapview.getController().setZoom(mapview.getMaxZoomLevel()-1);

		DetailBuilding detail = YoufangContext.getCurrentBuilding();
		if (detail == null) {
			return;
		}

		this.refreshMapview(detail);

	}

	public void refreshMapview(DetailBuilding detail) {
		this.mapview.getOverlays().clear();
		this.mapview.getOverlays().add(new BuildingOverlay(this, detail));
		this.moveToCenter(detail);
//		this.mapview.invalidate();
	}

}
